<?php
$this->Html->addCrumb('<i class="fa fa-home"></i> ' . Inflector::camelize($this->request->params ['prefix']), '/' . $this->request->params ['prefix'] . '/', array('escape' => false));
$this->Html->addCrumb('Banners', array('prefix' => $this->request->params['prefix'], 'controller' => $this->request->params['controller'], 'plugin' => $this->request->params['plugin'], 'action' => 'index'), array('escape' => false));
$this->Html->addCrumb('Alterar', NULL, array('escape' => false));

$this->Html->setAcoes('<i class="fa fa-plus"></i>' . __('new'), array('action' => 'add'), array('title' => __('new'), 'class' => 'btn btn-info', 'escapeTitle' => false));
$this->Html->setAcoes('<i class="fa fa-search"></i>' . __('List'), array('action' => 'index'), array('title' => __('List'), 'class' => 'btn btn-info', 'escapeTitle' => false));
?>
<?php

echo $this->Form->create('Banners.Banner', array(
    'inputDefaults' => array(
        'div' => 'form-group',
        'wrapInput' => false,
        'class' => 'form-control'
    )
        )
);
$preload_data = array();
if (isset($this->request->data['BannersHasPagina']) AND count($this->request->data['BannersHasPagina']) > 0) {
    foreach ($this->request->data['BannersHasPagina'] as $key => $value) {
        $preload_data[] = array('id' => $value['paginas_id'], 'text' => $value['Pagina']['nome']);
    }
}
echo '<div class="row" style="margin-bottom: 15px;">';
echo $this->Form->input('Banner.id', array('type' => 'hidden'));
echo $this->Form->input('Banner.nome', array('div' => array('class' => 'col-xs-4')));
echo $this->Form->status('Banner.status', array('div' => array('class' => 'col-xs-2')));
echo $this->Form->input('Banner.url', array('div' => array('class' => 'col-xs-6')));
echo $this->Form->input('Banner.ordem', array('div' => array('class' => 'col-xs-3')));
echo $this->Form->simNao('Banner.exibir_no_conteudo', array('label'=>'Exibir no detalhes do conteúdo','div' => array('class' => 'col-xs-3')));
echo $this->Form->target('Banner.target', array('div' => array('class' => 'col-xs-3')));
echo $this->Form->input('Banner.banners_posicao_id', array('div' => array('class' => 'col-xs-3')));
echo $this->Form->select2('BannersHasPagina.paginas_id', array('preload_data' => $preload_data, 'onMultiple' => 'true', 'url' => array('plugin' => 'paginas', 'controller' => 'paginas', 'action' => 'get'), 'type' => 'text', 'div' => array('class' => 'col-xs-12')));
echo '<div class="clearfix"></div>';
echo '<div style="margin-left: 15px;">' . $this->element('Midias.midias_upload', array('listaMidias' => $this->request->data['Banner'], 'model_ref' => 'Banner', 'multiple' => false)) . '</div>';
echo '</div>';
?>
<?php

echo $this->Form->button(__('Salvar'), array('type' => 'submit'));
echo $this->Form->end();
?>